//
//  LLEventOperation.h
//  LLEventSDK
//
//  Created by xuming on 2021/10/15.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIkit.h>

@protocol LLEventProtocol <NSObject>

@required
@property (nonatomic, copy, nonnull) NSString * event_id;
@property (nonatomic, strong, nonnull) NSDictionary * event_attr;

@optional
@property (nonatomic, strong, nullable) NSString * event_label;
@property (nonatomic, strong, nullable) NSString * event_from;
//@property (nonatomic, assign) long _Nullable event_duration;

@end

@interface LLEventOperation : NSObject

+ (nonnull instancetype)sharedInstance;

/// App启动埋点
/// @param launch 启动参数
- (void)launchWithProtocol:(id<LLEventProtocol> _Nullable)launch isAtonceUpload:(BOOL)atonce;

/// 页面开始显示时埋点
/// @param event 页面开始显示的埋点参数
- (void)pageViewStart:(id<LLEventProtocol> _Nullable)event;

/// 页面关闭时埋点
/// @param event 页面关闭的埋点参数
- (void)pageViewEnd:(id<LLEventProtocol> _Nullable)event isAtonceUpload:(BOOL)atonce;

/// 页面活跃时间埋点
/// @param event 页面活跃时间埋点参数
/// @param duration 页面活跃时间（毫秒）
- (void)pageViewDuration:(id<LLEventProtocol> _Nullable)event withDuration:(long)duration isAtonceUpload:(BOOL)atonce;

/// 操作事件埋点
/// @param event 事件埋点参数
- (void)actionEvent:(id<LLEventProtocol> _Nullable)event isAtonceUpload:(BOOL)atonce;

/// 操作事件开始埋点
/// @param event 事件开始埋点参数
- (void)actionEventStart:(id<LLEventProtocol> _Nullable)event;

/// 操作事件结束埋点
/// @param event 事件结束埋点参数
- (void)actionEventEnd:(id<LLEventProtocol> _Nullable)event isAtonceUpload:(BOOL)atonce;

/// 持续进行类操作事件埋点(例如按住发语音)
/// @param event 事件埋点参数
/// @param duration 操作事件持续时间（毫秒）
- (void)actionEvent:(id<LLEventProtocol> _Nullable)event withDuration:(long)duration isAtonceUpload:(BOOL)atonce;

/// 批量操作事件埋点
/// @param events 事件埋点参数
- (void)actionEvents:(NSArray<LLEventProtocol> * _Nullable)events isAtonceUpload:(BOOL)atonce;
@end
